package fr.umlv.m2.jee.jodatime.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public final class HsqldbOracleDate {
   private static final String HSQL_DATE_FORMAT="yyyy-mm-dd";

   private HsqldbOracleDate() {
       // do nothing
   }

   public static String toDate(String sDate, String pattern) throws ParseException {
      String low = pattern.toLowerCase();
      SimpleDateFormat sdf = new SimpleDateFormat(low);
      Date date = sdf.parse(sDate);
      sdf = new SimpleDateFormat(HSQL_DATE_FORMAT);

      return sdf.format(date).toString();
   }
}
